package com.aa.springboot_aa.exception;

import com.aa.springboot_aa.pojo.dto.Responsemessage;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.junit.platform.commons.logging.Logger;
import org.junit.platform.commons.logging.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice  // 统一处理
public class GlobalExceptionHandlerAdvice {




    @ExceptionHandler({Exception.class})    //表示要进行什么异常的统一处理
    public Responsemessage handlerException(Exception e, HttpServletRequest request, HttpServletResponse response){

        //可以通过记录日志的方式来判断具体的问题

        return new Responsemessage(500,"error",null);


    }
}
